<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="../js/vue.js"></script>
</head>
<body>

<div id="div1">

    <div>
        <span>数字1</span>
        <span>
            <input v-model="num1"  type="text"/>
        </span>
    </div>

    <div>
        <span>数字2</span>
        <span>
            <input v-model="num2"  type="text"/>
        </span>
    </div>

    <div>
        <button @click="handle">计算结果</button>
    </div>

    <div>
        <span>结果</span>
        <span>
            <input v-model="sum"  type="text"/>
        </span>
    </div>

</div>

<script>
    const vueobj = new Vue({
        el: '#div1',
        data: {
            num1: '',
            num2: '',
            sum: ''
        },
        methods:{
            handle: function () {
                this.sum = parseInt(this.num1) + parseInt(this.num2);
            },
        }
    })
</script>
</body>
</html>